package main

import "fmt"

/*
	define map
	var name map[key Type]val Type
	var m map[string]string = make(map[string]string, len, cap)

	// make(Type, len, caps) len cap 可以忽略
*/
func main() {
	var m map[string]string = make(map[string]string)
	fmt.Println(m) // map[]

	m["a"] = "aa"
	m["b"] = "bb"
	m["c"] = "cc"

	fmt.Println(m) // map[a:aa b:bb c:cc]

	cites := make(map[int]int)
	cites[1] = 2
	cites[2] = 3
	fmt.Println(cites[2])

	fmt.Println("-----------------")
	// 定义一个map 存放学生信息，包含name & sex

	stuMap := make(map[string]map[string]string)

	stuMap["stu01"] = make(map[string]string)
	stuMap["stu01"]["name"] = "zhangsan"
	stuMap["stu01"]["sex"] = "male"

	stuMap["stu02"] = make(map[string]string)
	stuMap["stu02"]["name"] = "lisi"
	stuMap["stu02"]["sex"] = "female"

	fmt.Println(stuMap)
	fmt.Println(stuMap["stu01"])
}
